<!doctype html><html class="theme-next pisces use-motion"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1"><meta http-equiv="Cache-Control" content="no-transform"><meta http-equiv="Cache-Control" content="no-siteapp"><link href="/vendors/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css"><link href="//fonts.googleapis.com/css?family=Monda:300,300italic,400,400italic,700,700italic|Monda:300,300italic,400,400italic,700,700italic|Monda:300,300italic,400,400italic,700,700italic|console:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css"><link href="/vendors/font-awesome/css/font-awesome.min.css?v=4.4.0" rel="stylesheet" type="text/css"><link href="/css/main.css?v=5.0.1" rel="stylesheet" type="text/css"><meta name="keywords" content="tcp/ip,http,web,ajax,javascript,"><link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.0.1"><meta name="description" content="Web&amp;#x662F;&amp;#x5EFA;&amp;#x7ACB;&amp;#x5728;HTTP(HyperText Transfer Protocol&amp;#xFF0C;&amp;#x8D85;&amp;#x6587;&amp;#x672C;&amp;#x4F20;&amp;#x8F93;&amp;#x534F;&amp;#x8BAE;)&amp;#x4E0A;&amp;#x901A;&amp;#x4FE1;&amp;#x7684;&amp;#x3002;&amp;#x672C;&amp;#x6587;&amp;#x662F;&amp;#x4"><meta property="og:type" content="article"><meta property="og:title" content="HTTP协议解析（一）"><meta property="og:url" content="http://yoursite.com/2016/06/21/HTTP协议解析（一）/index.html"><meta property="og:site_name" content="ziyi2"><meta property="og:description" content="Web&amp;#x662F;&amp;#x5EFA;&amp;#x7ACB;&amp;#x5728;HTTP(HyperText Transfer Protocol&amp;#xFF0C;&amp;#x8D85;&amp;#x6587;&amp;#x672C;&amp;#x4F20;&amp;#x8F93;&amp;#x534F;&amp;#x8BAE;)&amp;#x4E0A;&amp;#x901A;&amp;#x4FE1;&amp;#x7684;&amp;#x3002;&amp;#x672C;&amp;#x6587;&amp;#x662F;&amp;#x4"><meta property="og:image" content="http://yoursite.com/2016/06/21/HTTP协议解析（一）/tcpip.png"><meta property="og:image" content="http://yoursite.com/2016/06/21/HTTP协议解析（一）/send.png"><meta property="og:image" content="http://yoursite.com/2016/06/21/HTTP协议解析（一）/dns.png"><meta property="og:image" content="http://yoursite.com/2016/06/21/HTTP协议解析（一）/hand.png"><meta property="og:image" content="http://yoursite.com/2016/06/21/HTTP协议解析（一）/arp.png"><meta property="og:image" content="http://yoursite.com/2016/06/21/HTTP协议解析（一）/dns2.png"><meta property="og:image" content="http://yoursite.com/2016/06/21/HTTP协议解析（一）/trans.png"><meta property="og:image" content="http://yoursite.com/2016/06/21/HTTP协议解析（一）/bs.png"><meta property="og:image" content="http://yoursite.com/2016/06/21/HTTP协议解析（一）/cookie1.png"><meta property="og:image" content="http://yoursite.com/2016/06/21/HTTP协议解析（一）/cookie2.png"><meta property="og:updated_time" content="2016-06-21T01:46:38.000Z"><meta name="twitter:card" content="summary"><meta name="twitter:title" content="HTTP协议解析（一）"><meta name="twitter:description" content="Web&amp;#x662F;&amp;#x5EFA;&amp;#x7ACB;&amp;#x5728;HTTP(HyperText Transfer Protocol&amp;#xFF0C;&amp;#x8D85;&amp;#x6587;&amp;#x672C;&amp;#x4F20;&amp;#x8F93;&amp;#x534F;&amp;#x8BAE;)&amp;#x4E0A;&amp;#x901A;&amp;#x4FE1;&amp;#x7684;&amp;#x3002;&amp;#x672C;&amp;#x6587;&amp;#x662F;&amp;#x4"><meta name="twitter:image" content="http://yoursite.com/2016/06/21/HTTP协议解析（一）/tcpip.png"><script type="text/javascript" id="hexo.configuration">var NexT=window.NexT||{},CONFIG={scheme:"Pisces",sidebar:{position:"left",display:"post"},fancybox:!0,motion:!0,duoshuo:{userId:629674706219303e4,author:"博主小萌萌"}}</script><link rel="canonical" href="http://yoursite.com/2016/06/21/HTTP协议解析（一）/"><title> HTTP协议解析（一） | ziyi2</title></head><body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans"><script type="text/javascript">var _hmt=_hmt||[];!function(){var e=document.createElement("script");e.src="//hm.baidu.com/hm.js?0cb30035061d41c6cdeb72de4924d544";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)}()</script><div class="container one-collumn sidebar-position-left page-post-detail"><div class="headband"></div><header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader"><div class="header-inner"><div class="site-meta"><div class="custom-logo-site-title"><a href="/" class="brand" rel="start"><span class="logo-line-before"><i></i></span> <span class="site-title">ziyi2</span><span class="logo-line-after"><i></i></span></a></div><p class="site-subtitle">人生一世，草木一秋。</p></div><div class="site-nav-toggle"> <button><span class="btn-bar"></span><span class="btn-bar"></span><span class="btn-bar"></span></button></div><nav class="site-nav"><ul id="menu" class="menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="menu-item-icon fa fa-fw fa-home"></i><br> 首页</a></li><li class="menu-item menu-item-categories"><a href="/categories" rel="section"><i class="menu-item-icon fa fa-fw fa-th"></i><br> 分类</a></li><li class="menu-item menu-item-about"><a href="/about" rel="section"><i class="menu-item-icon fa fa-fw fa-user"></i><br> 关于</a></li><li class="menu-item menu-item-archives"><a href="/archives" rel="section"><i class="menu-item-icon fa fa-fw fa-archive"></i><br> 归档</a></li><li class="menu-item menu-item-tags"><a href="/tags" rel="section"><i class="menu-item-icon fa fa-fw fa-tags"></i><br> 标签</a></li><li class="menu-item menu-item-search"><a href="#" class="popup-trigger"><i class="menu-item-icon fa fa-search fa-fw"></i><br> 搜索</a></li></ul><div class="site-search"><div class="popup"><span class="search-icon fa fa-search"></span> <input type="text" id="local-search-input"><div id="local-search-result"></div> <span class="popup-btn-close">close</span></div></div></nav></div></header><main id="main" class="main"><div class="main-inner"><div class="content-wrap"><div id="content" class="content"><div id="posts" class="posts-expand"><article class="post post-type-normal" itemscope itemtype="http://schema.org/Article"><header class="post-header"><h1 class="post-title" itemprop="name headline"> HTTP协议解析（一）</h1><div class="post-meta"><span class="post-time"><span class="post-meta-item-icon"><i class="fa fa-calendar-o"></i></span> <span class="post-meta-item-text">发表于</span> <time itemprop="dateCreated" datetime="2016-06-21T09:23:19+08:00" content="2016-06-21">2016-06-21</time></span> <span class="post-category">&nbsp; | &nbsp;<span class="post-meta-item-icon"><i class="fa fa-folder-o"></i></span> <span class="post-meta-item-text">分类于</span> <span itemprop="about" itemscope itemtype="https://schema.org/Thing"><a href="/categories/技术/" itemprop="url" rel="index"><span itemprop="name">技术</span></a></span> ， <span itemprop="about" itemscope itemtype="https://schema.org/Thing"><a href="/categories/技术/web/" itemprop="url" rel="index"><span itemprop="name">web</span></a></span> ， <span itemprop="about" itemscope itemtype="https://schema.org/Thing"><a href="/categories/技术/web/http/" itemprop="url" rel="index"><span itemprop="name">http</span></a></span></span> <span class="post-comments-count">&nbsp; | &nbsp;<a href="/2016/06/21/HTTP协议解析（一）/#comments" itemprop="discussionUrl"><span class="post-comments-count ds-thread-count" data-thread-key="2016/06/21/HTTP协议解析（一）/" itemprop="commentsCount"></span></a></span></div></header><div class="post-body" itemprop="articleBody"><p>Web&#x662F;&#x5EFA;&#x7ACB;&#x5728;HTTP(HyperText Transfer Protocol&#xFF0C;&#x8D85;&#x6587;&#x672C;&#x4F20;&#x8F93;&#x534F;&#x8BAE;)&#x4E0A;&#x901A;&#x4FE1;&#x7684;&#x3002;&#x672C;&#x6587;&#x662F;&#x4E00;&#x7BC7;HTTP&#x534F;&#x8BAE;&#x5B66;&#x4E60;&#x7B14;&#x8BB0;&#xFF0C;&#x8865;&#x5145;&#x4E00;&#x4E0B;HTTP&#x534F;&#x8BAE;&#x7684;&#x57FA;&#x7840;&#xFF0C;&#x8FD9;&#x5BF9;&#x4E8E;&#x7406;&#x89E3;Ajax&#x4EE5;&#x53CA;&#x524D;&#x540E;&#x7AEF;&#x4EA4;&#x4E92;&#x8FC7;&#x7A0B;&#x7EDD;&#x5BF9;&#x662F;&#x975E;&#x5E38;&#x6709;&#x5E2E;&#x52A9;&#x7684;&#xFF0C;&#x672C;&#x6587;&#x7AE0;&#x4E3B;&#x8981;&#x8BB2;&#x8FF0;Web&#x57FA;&#x7840;&#x548C;&#x7B80;&#x5355;&#x7684;HTTP&#x534F;&#x8BAE;&#x2026;&#x2026;</p><a id="more"></a><h2 id="Web&#x57FA;&#x7840;"><a href="#Web&#x57FA;&#x7840;" class="headerlink" title="Web&#x57FA;&#x7840;"></a>Web&#x57FA;&#x7840;</h2><hr><p>&#x672C;&#x7AE0;&#x8282;&#x8BB2;&#x89E3;HTTP&#x5386;&#x53F2;&#x548C;TCP/IP&#x534F;&#x8BAE;&#x65CF;&#x3002;</p><h3 id="&#x4F7F;&#x7528;HTTP&#x534F;&#x8BAE;&#x8BBF;&#x95EE;Web"><a href="#&#x4F7F;&#x7528;HTTP&#x534F;&#x8BAE;&#x8BBF;&#x95EE;Web" class="headerlink" title="&#x4F7F;&#x7528;HTTP&#x534F;&#x8BAE;&#x8BBF;&#x95EE;Web"></a>&#x4F7F;&#x7528;HTTP&#x534F;&#x8BAE;&#x8BBF;&#x95EE;Web</h3><p>Web&#x9875;&#x9762;&#x662F;&#x5982;&#x4F55;&#x5448;&#x73B0;&#x7684;&#xFF1F;</p><ul><li>&#x5BA2;&#x6237;&#x7AEF;&#x901A;&#x8FC7;&#x6307;&#x5B9A;&#x7684;URL&#x5730;&#x5740;&#x83B7;&#x53D6;&#x670D;&#x52A1;&#x5668;&#x8D44;&#x6E90;</li><li>&#x670D;&#x52A1;&#x5668;&#x4F7F;&#x7528;HTTP&#x534F;&#x8BAE;&#x4F20;&#x8F93;&#x6587;&#x4EF6;&#x8D44;&#x6E90;</li></ul><h3 id="HTTP&#x8BDE;&#x751F;"><a href="#HTTP&#x8BDE;&#x751F;" class="headerlink" title="HTTP&#x8BDE;&#x751F;"></a>HTTP&#x8BDE;&#x751F;</h3><h4 id="Web&#x5386;&#x53F2;"><a href="#Web&#x5386;&#x53F2;" class="headerlink" title="Web&#x5386;&#x53F2;"></a>Web&#x5386;&#x53F2;</h4><ul><li>1989.03 HTTP&#x8BDE;&#x751F;</li><li>1990.11 CERN(&#x6B27;&#x6D32;&#x6838;&#x5B50;&#x7814;&#x7A76;&#x7EC4;&#x7EC7;)&#x7814;&#x53D1;&#x4E16;&#x754C;&#x4E0A;&#x7B2C;&#x4E00;&#x53F0;Web&#x670D;&#x52A1;&#x5668;&#x548C;Web&#x6D4F;&#x89C8;&#x5668;</li><li>1993.01 &#x73B0;&#x4EE3;&#x6D4F;&#x89C8;&#x5668;&#x7684;&#x7956;&#x5148;NCSA&#x7814;&#x53D1;&#x7684;Mosaic&#x95EE;&#x4E16;</li><li>1994.12 &#x7F51;&#x666F;&#x901A;&#x4FE1;&#x516C;&#x53F8;&#x53D1;&#x5E03;&#x4E86;Netscape Navigator 1.0</li><li>1995.xx &#x5FAE;&#x8F6F;&#x516C;&#x53F8;&#x53D1;&#x5E03;&#x4E86;IE 1.0&#x548C;2.0</li><li>1995.xx Apache 0.2&#x53D1;&#x5E03;</li><li>1995.xx HTML2.0&#x53D1;&#x5E03;</li><li>2004.xx Mozilla&#x57FA;&#x91D1;&#x4F1A;&#x53D1;&#x5E03;&#x4E86;Firefox&#x6D4F;&#x89C8;&#x5668;</li></ul><h4 id="HTTP&#x5386;&#x53F2;"><a href="#HTTP&#x5386;&#x53F2;" class="headerlink" title="HTTP&#x5386;&#x53F2;"></a>HTTP&#x5386;&#x53F2;</h4><ul><li>HTTP/0.9 HTTP/1.0&#x4E4B;&#x524D;&#x7684;&#x7248;&#x672C;</li><li>HTTP/1.0 &#x8BE5;&#x534F;&#x8BAE;&#x6807;&#x51C6;&#x4ECD;&#x88AB;&#x5E7F;&#x6CDB;&#x4F7F;&#x7528;&#x81F3;&#x670D;&#x52A1;&#x5668;</li><li>HTTP/1.1 &#x76EE;&#x524D;&#x4E3B;&#x6D41;&#x7684;&#x534F;&#x8BAE;&#x7248;&#x672C;</li></ul><h3 id="&#x7F51;&#x7EDC;&#x57FA;&#x7840;TCP-IP"><a href="#&#x7F51;&#x7EDC;&#x57FA;&#x7840;TCP-IP" class="headerlink" title="&#x7F51;&#x7EDC;&#x57FA;&#x7840;TCP/IP"></a>&#x7F51;&#x7EDC;&#x57FA;&#x7840;TCP/IP</h3><p>HTTP&#x662F;TCP/IP&#x534F;&#x8BAE;&#x65CF;&#x4E2D;&#x7684;&#x4E00;&#x4E2A;&#x5B50;&#x96C6;&#x3002;</p><h4 id="TCP-IP&#x534F;&#x8BAE;&#x65CF;"><a href="#TCP-IP&#x534F;&#x8BAE;&#x65CF;" class="headerlink" title="TCP/IP&#x534F;&#x8BAE;&#x65CF;"></a>TCP/IP&#x534F;&#x8BAE;&#x65CF;</h4><p>TCP/IP&#x662F;&#x4E92;&#x8054;&#x7F51;&#x76F8;&#x5173;&#x7684;&#x5404;&#x7C7B;&#x534F;&#x8BAE;&#x65CF;&#x7684;&#x603B;&#x79F0;&#xFF0C;&#x5305;&#x62EC;</p><ul><li>HTTP &#x2014; HyperText Transfer Protocol&#xFF0C;&#x8D85;&#x6587;&#x672C;&#x4F20;&#x8F93;&#x534F;&#x8BAE;</li><li>FTP &#x2014; File Transfer Protocil&#xFF0C;&#x6587;&#x4EF6;&#x4F20;&#x8F93;&#x534F;&#x8BAE;</li><li>DNS &#x2014; Domain Name System&#xFF0C;&#x57DF;&#x540D;&#x7CFB;&#x7EDF;</li><li>TCP &#x2014; Transmission Control Protocol&#xFF0C;&#x4F20;&#x8F93;&#x63A7;&#x5236;&#x534F;&#x8BAE;</li><li>UDP &#x2014; User Data Protocol&#xFF0C;&#x7528;&#x6237;&#x6570;&#x636E;&#x62A5;&#x534F;&#x8BAE;</li><li>IP &#x2014; Internet Protocol&#xFF0C;&#x7F51;&#x9645;&#x534F;&#x8BAE;</li><li>PPPoE</li><li>ICMP</li><li>FDDI</li><li>IEEE 802.3</li></ul><h4 id="TCP-IP&#x5206;&#x5C42;&#x7BA1;&#x7406;"><a href="#TCP-IP&#x5206;&#x5C42;&#x7BA1;&#x7406;" class="headerlink" title="TCP/IP&#x5206;&#x5C42;&#x7BA1;&#x7406;"></a>TCP/IP&#x5206;&#x5C42;&#x7BA1;&#x7406;</h4><p>&#x5206;&#x5C42;&#x7684;&#x597D;&#x5904;&#x662F;&#x5404;&#x5C42;&#x4E4B;&#x95F4;&#x4E92;&#x4E0D;&#x5E72;&#x6D89;&#x5F71;&#x54CD;&#xFF0C;&#x5982;&#x679C;&#x534F;&#x8BAE;&#x4E2D;&#x7684;&#x67D0;&#x4E2A;&#x5730;&#x65B9;&#x9700;&#x8981;&#x4FEE;&#x6539;&#xFF0C;&#x53EA;&#x9700;&#x8981;&#x4FEE;&#x6539;&#x67D0;&#x4E00;&#x5C42;&#x5373;&#x53EF;&#xFF0C;&#x800C;&#x4E0D;&#x9700;&#x8981;&#x6539;&#x53D8;&#x6574;&#x4F53;&#x3002;&#x53EA;&#x8981;&#x628A;&#x5404;&#x5C42;&#x4E4B;&#x95F4;&#x7684;&#x63A5;&#x53E3;&#x90E8;&#x5206;&#x89C4;&#x5212;&#x597D;&#xFF0C;&#x6BCF;&#x4E2A;&#x5C42;&#x6B21;&#x5185;&#x90E8;&#x7684;&#x8BBE;&#x8BA1;&#x5C31;&#x80FD;&#x591F;&#x81EA;&#x7531;&#x6539;&#x52A8;&#x4E86;&#x3002;&#x5206;&#x5C42;&#x5982;&#x4E0B;&#xFF1A;</p><ul><li>&#x5E94;&#x7528;&#x5C42;</li><li>&#x4F20;&#x8F93;&#x5C42;</li><li>&#x7F51;&#x7EDC;&#x5C42;&#xFF08;&#x7F51;&#x7EDC;&#x4E92;&#x8FDE;&#x5C42;&#xFF09;</li><li>&#x94FE;&#x8DEF;&#x5C42;&#xFF08;&#x7F51;&#x7EDC;&#x63A5;&#x53E3;&#x5C42;&#x3001;&#x6570;&#x636E;&#x94FE;&#x8DEF;&#x5C42;&#xFF09;</li></ul><h5 id="&#x5E94;&#x7528;&#x5C42;"><a href="#&#x5E94;&#x7528;&#x5C42;" class="headerlink" title="&#x5E94;&#x7528;&#x5C42;"></a>&#x5E94;&#x7528;&#x5C42;</h5><p>&#x51B3;&#x5B9A;&#x4E86;&#x5411;&#x7528;&#x6237;&#x63D0;&#x4F9B;&#x670D;&#x52A1;&#x65F6;&#x901A;&#x4FE1;&#x7684;&#x6D3B;&#x52A8;&#x3002;&#x5305;&#x62EC;FTP&#x534F;&#x8BAE;&#x3001;DNS&#x534F;&#x8BAE;&#x548C;HTTP&#x534F;&#x8BAE;&#x7B49;&#x3002;</p><h5 id="&#x4F20;&#x8F93;&#x5C42;"><a href="#&#x4F20;&#x8F93;&#x5C42;" class="headerlink" title="&#x4F20;&#x8F93;&#x5C42;"></a>&#x4F20;&#x8F93;&#x5C42;</h5><p>&#x4E0A;&#x5C42;&#x662F;&#x5E94;&#x7528;&#x5C42;&#xFF0C;&#x4E0B;&#x5C42;&#x662F;&#x7F51;&#x7EDC;&#x5C42;&#xFF0C;&#x63D0;&#x4F9B;&#x5904;&#x4E8E;&#x7F51;&#x7EDC;&#x8FDE;&#x63A5;&#x4E2D;&#x7684;&#x4E24;&#x53F0;&#x8BA1;&#x7B97;&#x673A;&#x4E4B;&#x95F4;&#x7684;&#x6570;&#x636E;&#x4F20;&#x8F93;&#x3002;&#x5305;&#x62EC;TCP&#x534F;&#x8BAE;&#x548C;UDP&#x534F;&#x8BAE;&#x3002;</p><h5 id="&#x7F51;&#x7EDC;&#x5C42;&#xFF08;&#x7F51;&#x7EDC;&#x4E92;&#x8FDE;&#x5C42;&#xFF09;"><a href="#&#x7F51;&#x7EDC;&#x5C42;&#xFF08;&#x7F51;&#x7EDC;&#x4E92;&#x8FDE;&#x5C42;&#xFF09;" class="headerlink" title="&#x7F51;&#x7EDC;&#x5C42;&#xFF08;&#x7F51;&#x7EDC;&#x4E92;&#x8FDE;&#x5C42;&#xFF09;"></a>&#x7F51;&#x7EDC;&#x5C42;&#xFF08;&#x7F51;&#x7EDC;&#x4E92;&#x8FDE;&#x5C42;&#xFF09;</h5><p>&#x4E0B;&#x5C42;&#x662F;&#x94FE;&#x8DEF;&#x5C42;&#xFF0C;&#x7528;&#x6765;&#x5904;&#x7406;&#x5728;&#x7F51;&#x7EDC;&#x4E0A;&#x6D41;&#x52A8;&#x7684;&#x6570;&#x636E;&#x5305;&#x3002;&#x6570;&#x636E;&#x5305;&#x662F;&#x7F51;&#x7EDC;&#x4F20;&#x8F93;&#x7684;&#x6700;&#x5C0F;&#x6570;&#x636E;&#x5355;&#x4F4D;&#x3002;&#x8BE5;&#x5C42;&#x89C4;&#x5B9A;&#x4E86;&#x4F20;&#x8F93;&#x8DEF;&#x7EBF;&#xFF08;&#x6709;&#x8DEF;&#x5F84;&#x7B97;&#x6CD5;&#xFF09;&#xFF0C;&#x5E76;&#x628A;&#x6570;&#x636E;&#x5305;&#x9001;&#x7ED9;&#x5BF9;&#x65B9;&#x3002;&#x7F51;&#x7EDC;&#x5C42;&#x7684;&#x4F5C;&#x7528;&#x5176;&#x5B9E;&#x5C31;&#x662F;&#x5728;&#x4F17;&#x591A;&#x7684;&#x7F51;&#x7EDC;&#x8BBE;&#x5907;&#x4E4B;&#x95F4;&#x4F20;&#x8F93;&#x65F6;&#x9009;&#x62E9;&#x4E00;&#x6761;&#x4F20;&#x8F93;&#x8DEF;&#x7EBF;&#x3002;</p><h5 id="&#x94FE;&#x8DEF;&#x5C42;&#xFF08;&#x7F51;&#x7EDC;&#x63A5;&#x53E3;&#x5C42;&#x3001;&#x6570;&#x636E;&#x94FE;&#x8DEF;&#x5C42;&#xFF09;"><a href="#&#x94FE;&#x8DEF;&#x5C42;&#xFF08;&#x7F51;&#x7EDC;&#x63A5;&#x53E3;&#x5C42;&#x3001;&#x6570;&#x636E;&#x94FE;&#x8DEF;&#x5C42;&#xFF09;" class="headerlink" title="&#x94FE;&#x8DEF;&#x5C42;&#xFF08;&#x7F51;&#x7EDC;&#x63A5;&#x53E3;&#x5C42;&#x3001;&#x6570;&#x636E;&#x94FE;&#x8DEF;&#x5C42;&#xFF09;"></a>&#x94FE;&#x8DEF;&#x5C42;&#xFF08;&#x7F51;&#x7EDC;&#x63A5;&#x53E3;&#x5C42;&#x3001;&#x6570;&#x636E;&#x94FE;&#x8DEF;&#x5C42;&#xFF09;</h5><p>&#x7528;&#x6765;&#x5904;&#x7406;&#x8FDE;&#x63A5;&#x7F51;&#x7EDC;&#x7684;&#x786C;&#x4EF6;&#x90E8;&#x5206;&#xFF0C;&#x5305;&#x62EC;&#x63A7;&#x5236;&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#x3001;&#x786C;&#x4EF6;&#x7684;&#x8BBE;&#x5907;&#x9A71;&#x52A8;&#x3001;&#x7F51;&#x7EDC;&#x9002;&#x914D;&#x5668;&#xFF08;&#x7F51;&#x5361;&#xFF09;&#x3001;&#x5149;&#x948E;&#x3001;&#x8FD8;&#x5305;&#x62EC;&#x8FDE;&#x63A5;&#x5668;&#x7B49;&#x4F20;&#x8F93;&#x5A92;&#x4ECB;&#x3002;&#x603B;&#x800C;&#x8A00;&#x4E4B;&#xFF0C;&#x786C;&#x4EF6;&#x4E0A;&#x7684;&#x8303;&#x7574;&#x90FD;&#x5728;&#x94FE;&#x8DEF;&#x5C42;&#x8303;&#x56F4;&#x4E4B;&#x5185;&#x3002;</p><h4 id="TCP-IP&#x901A;&#x4FE1;&#x4F20;&#x8F93;&#x6D41;"><a href="#TCP-IP&#x901A;&#x4FE1;&#x4F20;&#x8F93;&#x6D41;" class="headerlink" title="TCP/IP&#x901A;&#x4FE1;&#x4F20;&#x8F93;&#x6D41;"></a>TCP/IP&#x901A;&#x4FE1;&#x4F20;&#x8F93;&#x6D41;</h4><h5 id="&#x4F20;&#x8F93;&#x6D41;"><a href="#&#x4F20;&#x8F93;&#x6D41;" class="headerlink" title="&#x4F20;&#x8F93;&#x6D41;"></a>&#x4F20;&#x8F93;&#x6D41;</h5><p><img src="/2016/06/21/HTTP&#x534F;&#x8BAE;&#x89E3;&#x6790;&#xFF08;&#x4E00;&#xFF09;/tcpip.png" alt="tcp/ip"></p><h5 id="&#x53D1;&#x9001;&#x7AEF;&#x5C01;&#x88C5;"><a href="#&#x53D1;&#x9001;&#x7AEF;&#x5C01;&#x88C5;" class="headerlink" title="&#x53D1;&#x9001;&#x7AEF;&#x5C01;&#x88C5;"></a>&#x53D1;&#x9001;&#x7AEF;&#x5C01;&#x88C5;</h5><p><img src="/2016/06/21/HTTP&#x534F;&#x8BAE;&#x89E3;&#x6790;&#xFF08;&#x4E00;&#xFF09;/send.png" alt="tcp/ip"></p><blockquote><p>&#x63D0;&#x793A;&#xFF1A;&#x53D1;&#x9001;&#x7AEF;&#x5728;&#x5C42;&#x4E0E;&#x5C42;&#x4E4B;&#x95F4;&#x4F20;&#x8F93;&#x6570;&#x636E;&#x65F6;&#xFF0C;&#x6BCF;&#x7ECF;&#x8FC7;&#x4E00;&#x5C42;&#x65F6;&#x5FC5;&#x5B9A;&#x4F1A;&#x88AB;&#x6253;&#x4E0A;&#x4E00;&#x4E2A;&#x8BE5;&#x5C42;&#x6240;&#x5C5E;&#x7684;&#x9996;&#x90E8;&#x4FE1;&#x606F;&#x3002;</p></blockquote><h5 id="&#x63A5;&#x6536;&#x7AEF;&#x89E3;&#x5C01;"><a href="#&#x63A5;&#x6536;&#x7AEF;&#x89E3;&#x5C01;" class="headerlink" title="&#x63A5;&#x6536;&#x7AEF;&#x89E3;&#x5C01;"></a>&#x63A5;&#x6536;&#x7AEF;&#x89E3;&#x5C01;</h5><p>&#x63A5;&#x6536;&#x7AEF;&#x7684;&#x89E3;&#x5C01;&#x6D41;&#x7A0B;&#x6B63;&#x597D;&#x662F;&#x53D1;&#x9001;&#x7AEF;&#x7684;&#x9006;&#x6D41;&#x7A0B;&#x3002;</p><blockquote><p>&#x63D0;&#x793A;&#xFF1A;&#x63A5;&#x6536;&#x7AEF;&#x5728;&#x5C42;&#x4E0E;&#x5C42;&#x4E4B;&#x95F4;&#x4F20;&#x8F93;&#x6570;&#x636E;&#x65F6;&#xFF0C;&#x6BCF;&#x7ECF;&#x8FC7;&#x4E00;&#x5C42;&#x65F6;&#x5FC5;&#x5B9A;&#x4F1A;&#x628A;&#x5BF9;&#x5E94;&#x7684;&#x9996;&#x90E8;&#x6D88;&#x53BB;&#x3002;</p></blockquote><h3 id="DNS&#x3001;TCP&#x3001;IP"><a href="#DNS&#x3001;TCP&#x3001;IP" class="headerlink" title="DNS&#x3001;TCP&#x3001;IP"></a>DNS&#x3001;TCP&#x3001;IP</h3><h4 id="&#x8D1F;&#x8D23;&#x57DF;&#x540D;&#x89E3;&#x6790;&#x7684;DNS&#x670D;&#x52A1;"><a href="#&#x8D1F;&#x8D23;&#x57DF;&#x540D;&#x89E3;&#x6790;&#x7684;DNS&#x670D;&#x52A1;" class="headerlink" title="&#x8D1F;&#x8D23;&#x57DF;&#x540D;&#x89E3;&#x6790;&#x7684;DNS&#x670D;&#x52A1;"></a>&#x8D1F;&#x8D23;&#x57DF;&#x540D;&#x89E3;&#x6790;&#x7684;DNS&#x670D;&#x52A1;</h4><p>DNS&#x670D;&#x52A1;&#x4F4D;&#x4E8E;<strong>&#x5E94;&#x7528;&#x5C42;</strong>&#x3002;&#x63D0;&#x4F9B;&#x57DF;&#x540D;&#x5230;IP&#x5730;&#x5740;&#x4E4B;&#x95F4;&#x7684;&#x89E3;&#x6790;&#x670D;&#x52A1;&#x3002;&#x8BA1;&#x7B97;&#x673A;&#x4E0D;&#x4EC5;&#x53EF;&#x4EE5;&#x8D4B;&#x4E88;IP&#x5730;&#x5740;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x88AB;&#x8D4B;&#x4E88;&#x4E3B;&#x673A;&#x540D;&#x548C;&#x57DF;&#x540D;&#xFF0C;&#x4F8B;&#x5982;&#x57DF;&#x540D;www.baidu.com&#x3002;IP&#x5730;&#x5740;&#x4E0D;&#x597D;&#x8BB0;&#xFF0C;&#x8C01;&#x80FD;&#x8BB0;&#x4F4F;&#x4E00;&#x5927;&#x4E32;&#x6570;&#x5B57;&#xFF0C;&#x57DF;&#x540D;&#x5C31;&#x6BD4;&#x8F83;&#x597D;&#x8BB0;&#xFF0C;&#x6240;&#x4EE5;&#x8BBF;&#x95EE;&#x5BF9;&#x65B9;&#x8BA1;&#x7B97;&#x673A;&#x65F6;&#xFF0C;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x57DF;&#x540D;&#x8BBF;&#x95EE;&#x800C;&#x4E0D;&#x662F;IP&#x5730;&#x5740;&#x8BBF;&#x95EE;&#x3002;DNS&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x57DF;&#x540D;&#x67E5;&#x627E;IP&#x5730;&#x5740;&#x3002;<br><img src="/2016/06/21/HTTP&#x534F;&#x8BAE;&#x89E3;&#x6790;&#xFF08;&#x4E00;&#xFF09;/dns.png" alt="tcp/ip"></p><h4 id="&#x786E;&#x4FDD;&#x53EF;&#x9760;&#x7684;TCP&#x534F;&#x8BAE;"><a href="#&#x786E;&#x4FDD;&#x53EF;&#x9760;&#x7684;TCP&#x534F;&#x8BAE;" class="headerlink" title="&#x786E;&#x4FDD;&#x53EF;&#x9760;&#x7684;TCP&#x534F;&#x8BAE;"></a>&#x786E;&#x4FDD;&#x53EF;&#x9760;&#x7684;TCP&#x534F;&#x8BAE;</h4><p>TCP&#x534F;&#x8BAE;&#x4F4D;&#x4E8E;<strong>&#x4F20;&#x8F93;&#x5C42;</strong>&#xFF0C;&#x63D0;&#x4F9B;&#x53EF;&#x9760;&#x7684;&#x5B57;&#x8282;&#x6D41;&#x670D;&#x52A1;&#x3002;&#x5B57;&#x8282;&#x6D41;&#x670D;&#x52A1;&#x662F;&#x5C06;&#x5927;&#x5757;&#x7684;&#x6570;&#x636E;&#x5206;&#x5272;&#x4EE5;&#x62A5;&#x6587;&#x6BB5;&#x4E3A;&#x5355;&#x4F4D;&#x7684;&#x6570;&#x636E;&#x5305;&#x8FDB;&#x884C;&#x7BA1;&#x7406;&#xFF0C;&#x53EF;&#x9760;&#x7684;&#x4F20;&#x8F93;&#x670D;&#x52A1;&#x662F;&#x6307;&#x51C6;&#x786E;&#x53EF;&#x9760;&#x7684;&#x628A;&#x6570;&#x636E;&#x4F20;&#x8F93;&#x7ED9;&#x5BF9;&#x65B9;&#x3002;&#x4E3A;&#x4E86;&#x5B9E;&#x73B0;&#x53EF;&#x9760;&#x4F20;&#x8F93;&#xFF0C;TCP&#x534F;&#x8BAE;&#x91C7;&#x7528;<strong>&#x4E09;&#x6B21;&#x63E1;&#x624B;&#x4F20;&#x8F93;</strong>&#x7B56;&#x7565;&#x3002;<br><img src="/2016/06/21/HTTP&#x534F;&#x8BAE;&#x89E3;&#x6790;&#xFF08;&#x4E00;&#xFF09;/hand.png" alt="tcp/ip"></p><h4 id="&#x8D1F;&#x8D23;&#x4F20;&#x8F93;&#x7684;IP&#x534F;&#x8BAE;"><a href="#&#x8D1F;&#x8D23;&#x4F20;&#x8F93;&#x7684;IP&#x534F;&#x8BAE;" class="headerlink" title="&#x8D1F;&#x8D23;&#x4F20;&#x8F93;&#x7684;IP&#x534F;&#x8BAE;"></a>&#x8D1F;&#x8D23;&#x4F20;&#x8F93;&#x7684;IP&#x534F;&#x8BAE;</h4><p>IP&#x534F;&#x8BAE;&#x4F4D;&#x4E8E;<strong>&#x7F51;&#x7EDC;&#x5C42;</strong>&#xFF0C;&#x4F5C;&#x7528;&#x662F;&#x628A;&#x5404;&#x79CD;&#x6570;&#x636E;&#x5305;&#x4F20;&#x9001;&#x7ED9;&#x5BF9;&#x65B9;&#x3002;&#x8981;&#x4F20;&#x9001;&#x7ED9;&#x5BF9;&#x65B9;&#xFF0C;&#x9700;&#x8981;&#x4E24;&#x4E2A;&#x6761;&#x4EF6;&#xFF0C;IP&#x5730;&#x5740;&#x548C;MAC&#x5730;&#x5740;&#x3002;<br>| &#x7C7B;&#x578B; | &#x8BF4;&#x660E; | &#x533A;&#x522B; |<br>| :&#x2014;&#x2014;&#x2013; | :&#x2014;&#x2014;&#x2013;:| :&#x2013;: |<br>| IP | &#x6307;&#x660E;&#x4E86;&#x8282;&#x70B9;&#x88AB;&#x5206;&#x914D;&#x5230;&#x7684;&#x5730;&#x5740; | &#x5730;&#x5740;&#x53EF;&#x53D8; |<br>| MAC | &#x7F51;&#x7EDC;&#x9002;&#x914D;&#x5668;&#xFF08;&#x7F51;&#x5361;&#xFF09;&#x6240;&#x5C5E;&#x7684;&#x56FA;&#x5B9A;&#x5730;&#x5740; | &#x5730;&#x5740;&#x4E0D;&#x53EF;&#x53D8; |</p><p>&#x4F7F;&#x7528;ARP&#x534F;&#x8BAE;&#x51ED;&#x501F;MAC&#x5730;&#x5740;&#x8FDB;&#x884C;&#x901A;&#x4FE1;&#xFF0C;ARP&#x662F;&#x4E00;&#x79CD;&#x7528;&#x4EE5;&#x89E3;&#x6790;&#x5730;&#x5740;&#x7684;&#x534F;&#x8BAE;&#xFF0C;&#x6839;&#x636E;&#x901A;&#x4FE1;&#x65B9;&#x7684;IP&#x5730;&#x5740;&#x5C31;&#x53EF;&#x4EE5;&#x53CD;&#x67E5;&#x51FA;&#x5BF9;&#x5E94;&#x7684;MAC&#x5730;&#x5740;&#x3002;</p><p><img src="/2016/06/21/HTTP&#x534F;&#x8BAE;&#x89E3;&#x6790;&#xFF08;&#x4E00;&#xFF09;/arp.png" alt="tcp/ip"></p><h4 id="&#x5404;&#x79CD;&#x534F;&#x8BAE;&#x4E0E;HTTP&#x534F;&#x8BAE;&#x7684;&#x5173;&#x7CFB;"><a href="#&#x5404;&#x79CD;&#x534F;&#x8BAE;&#x4E0E;HTTP&#x534F;&#x8BAE;&#x7684;&#x5173;&#x7CFB;" class="headerlink" title="&#x5404;&#x79CD;&#x534F;&#x8BAE;&#x4E0E;HTTP&#x534F;&#x8BAE;&#x7684;&#x5173;&#x7CFB;"></a>&#x5404;&#x79CD;&#x534F;&#x8BAE;&#x4E0E;HTTP&#x534F;&#x8BAE;&#x7684;&#x5173;&#x7CFB;</h4><p>&#x7B2C;&#x4E00;&#x6B65;<br><img src="/2016/06/21/HTTP&#x534F;&#x8BAE;&#x89E3;&#x6790;&#xFF08;&#x4E00;&#xFF09;/dns2.png" alt="tcp/ip"></p><p>&#x7B2C;&#x4E8C;&#x6B65;<br><img src="/2016/06/21/HTTP&#x534F;&#x8BAE;&#x89E3;&#x6790;&#xFF08;&#x4E00;&#xFF09;/trans.png" alt="tcp/ip"></p><h3 id="URI&#x548C;URL"><a href="#URI&#x548C;URL" class="headerlink" title="URI&#x548C;URL"></a>URI&#x548C;URL</h3><p>&#x7701;&#x7565;&#x3002;</p><h2 id="&#x7B80;&#x5355;&#x7684;HTTP&#x534F;&#x8BAE;"><a href="#&#x7B80;&#x5355;&#x7684;HTTP&#x534F;&#x8BAE;" class="headerlink" title="&#x7B80;&#x5355;&#x7684;HTTP&#x534F;&#x8BAE;"></a>&#x7B80;&#x5355;&#x7684;HTTP&#x534F;&#x8BAE;</h2><hr><p>&#x672C;&#x7AE0;&#x8282;&#x8BB2;&#x89E3;HTTP/1.1&#x7248;&#x672C;&#x7684;&#x534F;&#x8BAE;&#x7ED3;&#x6784;&#x3002;</p><h3 id="HTTP&#x901A;&#x4FE1;"><a href="#HTTP&#x901A;&#x4FE1;" class="headerlink" title="HTTP&#x901A;&#x4FE1;"></a>HTTP&#x901A;&#x4FE1;</h3><p>HTTP&#x534F;&#x8BAE;&#x548C;TCP/IP&#x534F;&#x8BAE;&#x65CF;&#x4E2D;&#x7684;&#x5176;&#x4ED6;&#x534F;&#x8BAE;&#x90FD;&#x662F;&#x7528;&#x4E8E;&#x5BA2;&#x6237;&#x7AEF;&#x548C;&#x670D;&#x52A1;&#x5668;&#x4E4B;&#x95F4;&#x7684;&#x901A;&#x4FE1;&#x3002;</p><ul><li>&#x5BA2;&#x6237;&#x7AEF;&#xFF1A;&#x8BF7;&#x6C42;&#x8BBF;&#x95EE;&#x6587;&#x672C;&#x6216;&#x56FE;&#x50CF;&#x7B49;&#x8D44;&#x6E90;&#x7684;&#x4E00;&#x7AEF;</li><li>&#x670D;&#x52A1;&#x5668;&#x7AEF;&#xFF1A;&#x63D0;&#x4F9B;&#x8D44;&#x6E90;&#x54CD;&#x5E94;&#x7684;&#x4E00;&#x7AEF;</li></ul><p>&#x5728;&#x4E24;&#x53F0;&#x8BA1;&#x7B97;&#x673A;&#x4E4B;&#x95F4;&#x4F7F;&#x7528;HTTP&#x534F;&#x8BAE;&#x901A;&#x4FE1;&#x65F6;&#xFF0C;&#x5728;&#x4E00;&#x6761;&#x901A;&#x4FE1;&#x7EBF;&#x8DEF;&#x4E0A;&#x5FC5;&#x5B9A;&#x6709;&#x4E00;&#x7AEF;&#x662F;&#x5BA2;&#x6237;&#x7AEF;&#xFF0C;&#x53E6;&#x4E00;&#x7AEF;&#x662F;&#x670D;&#x52A1;&#x5668;&#x7AEF;&#x3002;</p><h3 id="HTTP&#x8BF7;&#x6C42;&#x548C;&#x54CD;&#x5E94;"><a href="#HTTP&#x8BF7;&#x6C42;&#x548C;&#x54CD;&#x5E94;" class="headerlink" title="HTTP&#x8BF7;&#x6C42;&#x548C;&#x54CD;&#x5E94;"></a>HTTP&#x8BF7;&#x6C42;&#x548C;&#x54CD;&#x5E94;</h3><p><img src="/2016/06/21/HTTP&#x534F;&#x8BAE;&#x89E3;&#x6790;&#xFF08;&#x4E00;&#xFF09;/bs.png" alt="tcp/ip"></p><p>HTTP&#x534F;&#x8BAE;&#x89C4;&#x5B9A;&#xFF0C;&#x8BF7;&#x6C42;&#x4ECE;&#x5BA2;&#x6237;&#x7AEF;&#x53D1;&#x51FA;&#xFF0C;&#x6700;&#x540E;&#x670D;&#x52A1;&#x5668;&#x7AEF;&#x76F8;&#x5E94;&#x8BE5;&#x8BF7;&#x6C42;&#x5E76;&#x8FD4;&#x56DE;&#x3002;&#x6CE8;&#x610F;&#x5FC5;&#x987B;&#x5148;&#x4ECE;&#x5BA2;&#x6237;&#x7AEF;&#x5F00;&#x59CB;&#x5EFA;&#x7ACB;&#x901A;&#x4FE1;&#xFF0C;&#x670D;&#x52A1;&#x5668;&#x7AEF;&#x5728;&#x6CA1;&#x6709;&#x63A5;&#x6536;&#x5230;&#x8BF7;&#x6C42;&#x4E4B;&#x95F4;&#x4E0D;&#x4F1A;&#x53D1;&#x9001;&#x54CD;&#x5E94;&#x3002;</p><h4 id="&#x8BF7;&#x6C42;&#x62A5;&#x6587;"><a href="#&#x8BF7;&#x6C42;&#x62A5;&#x6587;" class="headerlink" title="&#x8BF7;&#x6C42;&#x62A5;&#x6587;"></a>&#x8BF7;&#x6C42;&#x62A5;&#x6587;</h4><p>&#x5BA2;&#x6237;&#x7AEF;&#x53D1;&#x9001;&#x4E00;&#x4E2A;&#x8BF7;&#x6C42;&#xFF0C;&#x8BF7;&#x6C42;&#x62A5;&#x6587;&#x6784;&#x6210;&#x793A;&#x4F8B;&#x5982;&#x4E0B;&#xFF1A;</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">//&#x8BF7;&#x6C42;&#x65B9;&#x6CD5;&#xFF0C;URL</span><br><span class="line">Request URL:http://localhost:7101/signup</span><br><span class="line">Request Method:POST</span><br><span class="line"></span><br><span class="line">//&#x8BF7;&#x6C42;&#x9996;&#x90E8;&#x5B57;&#x6BB5;</span><br><span class="line">Connection:keep-alive</span><br><span class="line">Content-Type:application/x-www-form-urlencoded</span><br><span class="line">Content-Length:29</span><br><span class="line">Host:localhost:7101</span><br><span class="line"></span><br><span class="line">//&#x5185;&#x5BB9;&#x5B9E;&#x4F53;&#xFF08;&#x8BF7;&#x6C42;&#x4E3B;&#x4F53;&#xFF09;</span><br><span class="line">name=admin3&amp;password=22222222</span><br></pre></td></tr></table></figure><p>&#x8BF7;&#x6C42;&#x62A5;&#x6587;&#x4E00;&#x822C;&#x7531;&#x4EE5;&#x4E0B;&#x6784;&#x6210;</p><ul><li>&#x8BF7;&#x6C42;&#x65B9;&#x6CD5;&#xFF0C;URI&#xFF08;&#x7C97;&#x7565;&#x7684;&#x53EF;&#x4EE5;&#x8BF4;&#x662F;URL&#xFF09;</li><li>&#x53EF;&#x9009;&#x7684;&#x8BF7;&#x6C42;&#x5934;&#x9996;&#x90E8;&#x5B57;&#x6BB5;</li><li>&#x5185;&#x5BB9;&#x5B9E;&#x4F53;&#xFF08;&#x8BF7;&#x6C42;&#x4E3B;&#x4F53;&#xFF09;</li></ul><h4 id="&#x54CD;&#x5E94;&#x62A5;&#x6587;"><a href="#&#x54CD;&#x5E94;&#x62A5;&#x6587;" class="headerlink" title="&#x54CD;&#x5E94;&#x62A5;&#x6587;"></a>&#x54CD;&#x5E94;&#x62A5;&#x6587;</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">//&#x54CD;&#x5E94;&#x72B6;&#x6001;&#x7801;</span><br><span class="line">Status Code:200 OK</span><br><span class="line"></span><br><span class="line">//&#x54CD;&#x5E94;&#x9996;&#x90E8;&#x5B57;&#x6BB5;</span><br><span class="line">Date:Mon, 20 Jun 2016 10:38:42 GMT</span><br><span class="line">Content-Length:9</span><br><span class="line">Content-Type:application/json; charset=utf-8</span><br><span class="line"></span><br><span class="line">//&#x54CD;&#x5E94;&#x4E3B;&#x4F53;</span><br><span class="line">{&quot;msg&quot;:2}</span><br></pre></td></tr></table></figure><p>&#x54CD;&#x5E94;&#x62A5;&#x6587;&#x4E00;&#x822C;&#x7531;&#x4EE5;&#x4E0B;&#x6784;&#x6210;</p><ul><li>&#x54CD;&#x5E94;&#x72B6;&#x6001;&#x7801;</li><li>&#x7528;&#x4E8E;&#x89E3;&#x91CA;&#x72B6;&#x6001;&#x7801;&#x7684;&#x539F;&#x56E0;&#x8BED;&#x53E5;&#xFF08;&#x4F8B;&#x5982;OK&#xFF0C;Not Modified&#x7B49;&#xFF09;</li><li>&#x53EF;&#x9009;&#x7684;&#x54CD;&#x5E94;&#x9996;&#x90E8;&#x5B57;&#x6BB5;</li><li>&#x54CD;&#x5E94;&#x4E3B;&#x4F53;</li></ul><h4 id="Ajax&#x793A;&#x4F8B;"><a href="#Ajax&#x793A;&#x4F8B;" class="headerlink" title="Ajax&#x793A;&#x4F8B;"></a>Ajax&#x793A;&#x4F8B;</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br></pre></td><td class="code"><pre><span class="line">function postFormData(url,data,callback){</span><br><span class="line"></span><br><span class="line">    if(window.XMLHttpRequest){        //&#x521B;&#x5EFA;&#x4E00;&#x4E2A;XHR&#x5BF9;&#x8C61;</span><br><span class="line">        req = new XMLHttpRequest();</span><br><span class="line">    } else if(window.ActiveXObject){ //&#x517C;&#x5BB9;IE</span><br><span class="line">        req = new ActiveXObject(&apos;Microsoft.XMLHTTP&apos;);</span><br><span class="line">    }</span><br><span class="line"></span><br><span class="line">    /*1.&#x8BF7;&#x6C42;&#x65B9;&#x6CD5;&#x548C;URL*/</span><br><span class="line">    request.open(&apos;POST&apos;,url);  </span><br><span class="line"></span><br><span class="line">    request.onreadystatechange = function(){</span><br><span class="line">        if(request.readyState === 4){</span><br><span class="line">            /*4.&#x54CD;&#x5E94;&#x72B6;&#x6001;&#x7801;*/</span><br><span class="line">            if(request.state === 200){  </span><br><span class="line">                /*5.&#x53EF;&#x9009;&#x7684;&#x54CD;&#x5E94;&#x9996;&#x90E8;&#x5B57;&#x6BB5;*/</span><br><span class="line">                var type = req.getResponseHeader(&quot;Content-Type&quot;);</span><br><span class="line">                var size = req.getResponseHeader(&quot;Content-Length&quot;);</span><br><span class="line"></span><br><span class="line">                /*6.&#x54CD;&#x5E94;&#x4E3B;&#x4F53;*/</span><br><span class="line">                if(type.indexOf(&apos;xml&apos;) !== -1 &amp;&amp; request.responseXML){</span><br><span class="line">                    callback(request.responseXML);              //XML Document&#x5BF9;&#x8C61;&#x54CD;&#x5E94;</span><br><span class="line">                } else if(type === &apos;application/json&apos;){</span><br><span class="line">                    callback(JSON.parse(request.responseText)); //JSON&#x54CD;&#x5E94;</span><br><span class="line">                } else{</span><br><span class="line">                    callback(request.responseText);             //&#x5B57;&#x7B26;&#x4E32;&#x54CD;&#x5E94;</span><br><span class="line">                }</span><br><span class="line">            }</span><br><span class="line">        }</span><br><span class="line">    };</span><br><span class="line"></span><br><span class="line">    /*2.&#x53EF;&#x9009;&#x7684;&#x8BF7;&#x6C42;&#x5934;&#x9996;&#x90E8;&#x5B57;&#x6BB5;*/</span><br><span class="line">    request.setRequestHeader(&apos;Content-Type&apos;,&apos;application/x-www-form-urlencoded&apos;); //&#x8BBE;&#x7F6E;Content-Type</span><br><span class="line">    /*3.&#x8BF7;&#x6C42;&#x4E3B;&#x4F53;*/</span><br><span class="line">    request.send(encodeFormData(data)); //&#x53D1;&#x9001;&#x8868;&#x5355;&#x7F16;&#x7801;&#x6570;&#x636E;</span><br><span class="line">}</span><br></pre></td></tr></table></figure><h3 id="HTTP&#x662F;&#x4E0D;&#x4FDD;&#x5B58;&#x72B6;&#x6001;"><a href="#HTTP&#x662F;&#x4E0D;&#x4FDD;&#x5B58;&#x72B6;&#x6001;" class="headerlink" title="HTTP&#x662F;&#x4E0D;&#x4FDD;&#x5B58;&#x72B6;&#x6001;"></a>HTTP&#x662F;&#x4E0D;&#x4FDD;&#x5B58;&#x72B6;&#x6001;</h3><p>HTTP&#x662F;&#x4E00;&#x79CD;&#x65E0;&#x72B6;&#x6001;&#x534F;&#x8BAE;&#xFF0C;HTTP&#x534F;&#x8BAE;&#x81EA;&#x8EAB;&#x4E0D;&#x5BF9;&#x8BF7;&#x6C42;&#x548C;&#x54CD;&#x5E94;&#x4E4B;&#x95F4;&#x7684;&#x901A;&#x4FE1;&#x72B6;&#x6001;&#x8FDB;&#x884C;&#x4FDD;&#x5B58;&#x3002;&#x6BCF;&#x5F53;&#x65B0;&#x7684;&#x8BF7;&#x6C42;&#x53D1;&#x9001;&#x65F6;&#xFF0C;&#x5C31;&#x4F1A;&#x5BF9;&#x5E94;&#x65B0;&#x7684;&#x54CD;&#x5E94;&#x4EA7;&#x751F;&#xFF0C;&#x534F;&#x8BAE;&#x672C;&#x8EAB;&#x5E76;&#x4E0D;&#x4F1A;&#x4FDD;&#x7559;&#x4E4B;&#x524D;&#x4E00;&#x5207;&#x7684;&#x8BF7;&#x6C42;&#x548C;&#x54CD;&#x5E94;&#x62A5;&#x6587;&#x4FE1;&#x606F;&#x3002;&#x5F53;&#x7136;&#xFF0C;&#x65E0;&#x72B6;&#x6001;&#x5BFC;&#x81F4;&#x4E86;&#x4E1A;&#x52A1;&#x5904;&#x7406;&#x80FD;&#x529B;&#x51CF;&#x5F31;&#xFF0C;&#x6BD4;&#x5982;&#x767B;&#x5F55;&#x7F51;&#x7AD9;&#x65F6;&#xFF0C;&#x8DF3;&#x8F6C;&#x5230;&#x8BE5;&#x7AD9;&#x7684;&#x5176;&#x4ED6;&#x9875;&#x9762;&#xFF0C;&#x4E5F;&#x9700;&#x8981;&#x80FD;&#x591F;&#x7EE7;&#x7EED;&#x4FDD;&#x6301;&#x767B;&#x5F55;&#x72B6;&#x6001;&#xFF0C;&#x6B64;&#x65F6;&#x5C31;&#x9700;&#x8981;&#x4FDD;&#x5B58;&#x7528;&#x6237;&#x7684;&#x72B6;&#x6001;&#xFF0C;&#x6240;&#x4EE5;&#x4E3A;&#x4E86;&#x5B9E;&#x73B0;&#x8FD9;&#x4E2A;&#x72B6;&#x6001;&#x529F;&#x80FD;&#xFF0C;&#x5F15;&#x5165;&#x4E86;<strong>cookie</strong>&#x6280;&#x672F;&#x3002;&#x6709;&#x4E86;<strong>cookie</strong>&#x518D;&#x7528;HTTP&#x534F;&#x8BAE;&#x901A;&#x4FE1;&#xFF0C;&#x5C31;&#x53EF;&#x4EE5;&#x7BA1;&#x7406;&#x72B6;&#x6001;&#x4E86;&#x3002;</p><h3 id="&#x8BF7;&#x6C42;URI&#x5B9A;&#x4F4D;&#x8D44;&#x6E90;"><a href="#&#x8BF7;&#x6C42;URI&#x5B9A;&#x4F4D;&#x8D44;&#x6E90;" class="headerlink" title="&#x8BF7;&#x6C42;URI&#x5B9A;&#x4F4D;&#x8D44;&#x6E90;"></a>&#x8BF7;&#x6C42;URI&#x5B9A;&#x4F4D;&#x8D44;&#x6E90;</h3><p>HTTP&#x534F;&#x8BAE;&#x4F7F;&#x7528;URI&#x5B9A;&#x4F4D;&#x4E92;&#x8054;&#x7F51;&#x4E0A;&#x7684;&#x8D44;&#x6E90;&#xFF0C;&#x5F53;&#x5BA2;&#x6237;&#x7AEF;&#x8BF7;&#x6C42;&#x8BBF;&#x95EE;&#x8D44;&#x6E90;&#x800C;&#x53D1;&#x9001;&#x8BF7;&#x6C42;&#x65F6;&#xFF0C;URI&#x9700;&#x8981;&#x5C06;&#x4F5C;&#x4E3A;&#x8BF7;&#x6C42;&#x62A5;&#x6587;&#x4E2D;&#x7684;&#x8BF7;&#x6C42;URI&#x5305;&#x542B;&#x5728;&#x5185;&#x3002;</p><h3 id="HTTP&#x8BF7;&#x6C42;&#x65B9;&#x6CD5;"><a href="#HTTP&#x8BF7;&#x6C42;&#x65B9;&#x6CD5;" class="headerlink" title="HTTP&#x8BF7;&#x6C42;&#x65B9;&#x6CD5;"></a>HTTP&#x8BF7;&#x6C42;&#x65B9;&#x6CD5;</h3><table><thead><tr><th style="text-align:left">&#x8BF7;&#x6C42;&#x7C7B;&#x578B;</th><th style="text-align:center">&#x8BF4;&#x660E;</th><th style="text-align:center">&#x4F5C;&#x7528;</th><th style="text-align:center">&#x652F;&#x6301;&#x7684;HTTP&#x534F;&#x8BAE;&#x7684;&#x7248;&#x672C;</th></tr></thead><tbody><tr><td style="text-align:left">GET</td><td style="text-align:center">&#x8BF7;&#x6C42;&#x8BBF;&#x95EE;&#x5DF2;&#x88AB;URI&#x8BC6;&#x522B;&#x7684;&#x8D44;&#x6E90;&#xFF0C;&#x6307;&#x5B9A;&#x7684;&#x8D44;&#x6E90;&#x7ECF;&#x670D;&#x52A1;&#x5668;&#x89E3;&#x6790;&#x540E;&#x8FD4;&#x56DE;&#x54CD;&#x5E94;&#x5185;&#x5BB9;</td><td style="text-align:center">&#x83B7;&#x53D6;&#x8D44;&#x6E90;</td><td style="text-align:center">1.0&#x3001;1&#xFF0C;1</td></tr><tr><td style="text-align:left">POST</td><td style="text-align:center">&#x5C3D;&#x7BA1;GET&#x4E5F;&#x53EF;&#x4EE5;&#x4F20;&#x8F93;&#x5B9E;&#x4F53;&#x4E3B;&#x4F53;&#xFF0C;&#x4F46;&#x662F;&#x4E00;&#x822C;&#x8FD8;&#x662F;&#x7528;POST&#x4F20;&#x8F93;&#xFF0C;POST&#x7684;&#x4E3B;&#x8981;&#x76EE;&#x7684;&#x5E76;&#x4E0D;&#x662F;&#x83B7;&#x53D6;&#x54CD;&#x5E94;&#x5185;&#x5BB9;</td><td style="text-align:center">&#x4F20;&#x8F93;&#x5B9E;&#x4F53;&#x4E3B;&#x4F53;</td><td style="text-align:center">1.0&#x3001;1&#xFF0C;1</td></tr><tr><td style="text-align:left">PUT</td><td style="text-align:center">&#x5C31;&#x50CF;FTP&#x534F;&#x8BAE;&#x7684;&#x6587;&#x4EF6;&#x4E0A;&#x4F20;&#x4E00;&#x6837;&#xFF0C;&#x8981;&#x6C42;&#x5728;&#x8BF7;&#x6C42;&#x62A5;&#x6587;&#x7684;&#x4E3B;&#x4F53;&#x4E2D;&#x5305;&#x542B;&#x6587;&#x4EF6;&#x5185;&#x5BB9;&#xFF0C;&#x6CA1;&#x6709;&#x9A8C;&#x8BC1;&#x673A;&#x5236;&#xFF0C;&#x4E00;&#x822C;Web&#x7F51;&#x7AD9;&#x4E0D;&#x4F7F;&#x7528;</td><td style="text-align:center">&#x4F20;&#x8F93;&#x6587;&#x4EF6;</td><td style="text-align:center">1.0&#x3001;1&#xFF0C;1</td></tr><tr><td style="text-align:left">HEAD</td><td style="text-align:center">HEAD&#x65B9;&#x6CD5;&#x548C;GET&#x65B9;&#x6CD5;&#x7C7B;&#x4F3C;&#xFF0C;&#x533A;&#x522B;&#x662F;&#x4E0D;&#x83B7;&#x53D6;&#x62A5;&#x6587;&#x54CD;&#x5E94;&#x4E3B;&#x4F53;&#xFF0C;&#x7528;&#x4E8E;&#x786E;&#x8BA4;URI&#x7684;&#x6709;&#x6548;&#x6027;&#x53CA;&#x8D44;&#x6E90;&#x66F4;&#x65B0;&#x7684;&#x65E5;&#x671F;&#x7B49;</td><td style="text-align:center">&#x83B7;&#x53D6;&#x62A5;&#x6587;&#x9996;&#x90E8;</td><td style="text-align:center">1.0&#x3001;1&#xFF0C;1</td></tr><tr><td style="text-align:left">DELETE</td><td style="text-align:center">&#x4E0E;PUT&#x65B9;&#x6CD5;&#x76F8;&#x53CD;&#xFF0C;&#x4E5F;&#x6CA1;&#x6709;&#x9A8C;&#x8BC1;&#x673A;&#x5236;</td><td style="text-align:center">&#x5220;&#x9664;&#x6587;&#x4EF6;</td><td style="text-align:center">1.0&#x3001;1&#xFF0C;1</td></tr><tr><td style="text-align:left">OPTIONS</td><td style="text-align:center">&#x67E5;&#x8BE2;&#x9488;&#x5BF9;&#x7279;&#x5B9A;&#x8BF7;&#x6C42;URI&#x6307;&#x5B9A;&#x7684;&#x8D44;&#x6E90;&#x7684;&#x652F;&#x6301;&#x7684;&#x65B9;&#x6CD5;</td><td style="text-align:center">&#x8BE2;&#x95EE;&#x652F;&#x6301;&#x7684;&#x65B9;&#x6CD5;</td><td style="text-align:center">1&#xFF0C;1</td></tr><tr><td style="text-align:left">TRACE</td><td style="text-align:center">&#x901A;&#x5E38;&#x4E0D;&#x4F1A;&#x7528;&#xFF0C;&#x5BB9;&#x6613;&#x5F15;&#x53D1;XST&#xFF08;&#x8DE8;&#x7AD9;&#x8FFD;&#x8E2A;&#xFF09;&#x653B;&#x51FB;</td><td style="text-align:center">&#x8DDF;&#x8E2A;&#x8DEF;&#x5F84;</td><td style="text-align:center">1&#xFF0C;1</td></tr><tr><td style="text-align:left">CONNECT</td><td style="text-align:center">&#x5B9E;&#x73B0;&#x7528;&#x96A7;&#x9053;&#x534F;&#x8BAE;&#x8FDB;&#x884C;TCP&#x901A;&#x4FE1;</td><td style="text-align:center">&#x8981;&#x6C42;&#x7528;&#x96A7;&#x9053;&#x534F;&#x8BAE;&#x8FDE;&#x63A5;&#x4EE3;&#x7406;</td><td style="text-align:center">1&#xFF0C;1</td></tr></tbody></table><blockquote><p>&#x63D0;&#x793A;&#xFF1A;HTTP/1.0&#x8FD8;&#x652F;&#x6301;LINK&#xFF08;&#x5EFA;&#x7ACB;&#x548C;&#x8D44;&#x6E90;&#x4E4B;&#x95F4;&#x7684;&#x8054;&#x7CFB;&#xFF09;&#x3001;UNLINK&#xFF08;&#x65AD;&#x5F00;&#x8FDE;&#x63A5;&#x5173;&#x7CFB;&#xFF09;&#x65B9;&#x6CD5;&#xFF0C;&#x4F46;&#x662F;&#x5728;HTTP/1.1&#x4E2D;&#x88AB;&#x5E9F;&#x5F03;&#x3002;&#x6B64;&#x5916;&#xFF0C;&#x65B9;&#x6CD5;&#x540D;&#x533A;&#x5206;&#x5927;&#x5C0F;&#x5199;&#xFF0C;&#x6CE8;&#x610F;&#x8981;&#x7528;&#x5927;&#x5199;&#x5B57;&#x6BCD;&#x3002;</p></blockquote><h3 id="&#x6301;&#x4E45;&#x8FDE;&#x63A5;&#x8282;&#x7701;&#x901A;&#x4FE1;&#x91CF;"><a href="#&#x6301;&#x4E45;&#x8FDE;&#x63A5;&#x8282;&#x7701;&#x901A;&#x4FE1;&#x91CF;" class="headerlink" title="&#x6301;&#x4E45;&#x8FDE;&#x63A5;&#x8282;&#x7701;&#x901A;&#x4FE1;&#x91CF;"></a>&#x6301;&#x4E45;&#x8FDE;&#x63A5;&#x8282;&#x7701;&#x901A;&#x4FE1;&#x91CF;</h3><p>HTTP&#x521D;&#x59CB;&#x7248;&#x672C;&#x4E2D;&#xFF0C;&#x6BCF;&#x5EFA;&#x7ACB;&#x4E00;&#x6B21;&#x8FDE;&#x63A5;&#xFF0C;HTTP&#x901A;&#x4FE1;&#x5C31;&#x8981;&#x65AD;&#x5F00;&#x4E00;&#x6B21;TCP&#x8FDE;&#x63A5;&#x3002;&#x968F;&#x7740;HTTP&#x8BF7;&#x6C42;&#x7684;&#x4E3B;&#x4F53;&#x5185;&#x5BB9;&#x8D8A;&#x6765;&#x8D8A;&#x5927;&#xFF0C;&#x663E;&#x7136;&#x8FD9;&#x6837;&#x7684;&#x6027;&#x80FD;&#x662F;&#x4E0D;&#x591F;&#x7684;&#xFF0C;&#x6BD4;&#x5982;&#x83B7;&#x53D6;&#x4E00;&#x4E2A;&#x7F51;&#x9875;&#x4FE1;&#x606F;&#x65F6;&#xFF0C;&#x83B7;&#x53D6;HTML&#x6587;&#x6863;&#x5EFA;&#x7ACB;&#x548C;&#x65AD;&#x5F00;&#x4E00;&#x6B21;TCP&#x8FDE;&#x63A5;&#xFF0C;&#x83B7;&#x53D6;&#x56FE;&#x7247;&#x53C8;&#x662F;&#x4E00;&#x6B21;&#xFF0C;&#x83B7;&#x53D6;&#x53E6;&#x5916;&#x4E00;&#x5F20;&#x56FE;&#x7247;&#x53C8;&#x662F;&#x4E00;&#x6B21;&#xFF0C;&#x589E;&#x52A0;&#x4E86;&#x901A;&#x4FE1;&#x91CF;&#x7684;&#x5F00;&#x9500;&#x3002;</p><h4 id="&#x6301;&#x4E45;&#x8FDE;&#x63A5;"><a href="#&#x6301;&#x4E45;&#x8FDE;&#x63A5;" class="headerlink" title="&#x6301;&#x4E45;&#x8FDE;&#x63A5;"></a>&#x6301;&#x4E45;&#x8FDE;&#x63A5;</h4><p>&#x9488;&#x5BF9;&#x4E0A;&#x8FF0;&#x95EE;&#x9898;&#xFF0C;HTTP/1.1&#x548C;&#x90E8;&#x5206;HTTP/1.0&#x60F3;&#x51FA;&#x4E86;&#x6301;&#x4E45;&#x8FDE;&#x63A5;&#xFF08;HTTP keep-alive&#xFF09;&#x7684;&#x65B9;&#x6CD5;&#x3002;&#x53EA;&#x8981;&#x4EFB;&#x610F;&#x4E00;&#x7AEF;&#x6CA1;&#x6709;&#x660E;&#x786E;&#x63D0;&#x51FA;&#x65AD;&#x5F00;&#x8FDE;&#x63A5;&#xFF0C;&#x5219;&#x4FDD;&#x6301;TCP&#x8FDE;&#x63A5;&#x72B6;&#x6001;&#x3002;&#x6301;&#x4E45;&#x8FDE;&#x63A5;&#x65E8;&#x5728;&#x5EFA;&#x7ACB;1&#x6B21;TCP&#x8FDE;&#x63A5;&#x540E;&#x8FDB;&#x884C;&#x591A;&#x6B21;&#x8BF7;&#x6C42;&#x548C;&#x54CD;&#x5E94;&#x7684;&#x4EA4;&#x4E92;&#x3002;&#x5728;HTTP/1.1&#x4E2D;&#x6240;&#x6709;&#x7684;&#x8FDE;&#x63A5;&#x9ED8;&#x8BA4;&#x90FD;&#x662F;&#x6301;&#x4E45;&#x8FDE;&#x63A5;&#xFF0C;&#x4F46;&#x5728;HTTP/1.0&#x5185;&#x5E76;&#x6CA1;&#x6709;&#x6807;&#x51C6;&#x5316;&#x3002;</p><h4 id="&#x7BA1;&#x7EBF;&#x5316;"><a href="#&#x7BA1;&#x7EBF;&#x5316;" class="headerlink" title="&#x7BA1;&#x7EBF;&#x5316;"></a>&#x7BA1;&#x7EBF;&#x5316;</h4><p>&#x6301;&#x4E45;&#x8FDE;&#x63A5;&#x9020;&#x5C31;&#x4E86;&#x7BA1;&#x7EBF;&#x5316;&#x65B9;&#x5F0F;&#x53D1;&#x9001;&#x3002;&#x4EE5;&#x524D;&#x53D1;&#x9001;&#x8BF7;&#x6C42;&#x662F;&#x4E32;&#x884C;&#x7684;&#xFF0C;&#x53D1;&#x9001;&#x4E00;&#x4E2A;&#x8BF7;&#x6C42;&#x5FC5;&#x987B;&#x5F97;&#x5230;&#x54CD;&#x5E94;&#x624D;&#x80FD;&#x53D1;&#x9001;&#x4E0B;&#x4E00;&#x4E2A;&#x8BF7;&#x6C42;&#xFF0C;&#x7BA1;&#x7EBF;&#x5316;&#x6280;&#x672F;&#x51FA;&#x73B0;&#x540E;&#xFF0C;&#x4E0D;&#x7528;&#x7B49;&#x5F85;&#x54CD;&#x5E94;&#x4EA6;&#x53EF;&#x76F4;&#x63A5;&#x53D1;&#x9001;&#x4E0B;&#x4E00;&#x4E2A;&#x8BF7;&#x6C42;&#x3002;&#x8FD9;&#x6837;&#x53EF;&#x4EE5;&#x505A;&#x5230;&#x540C;&#x65F6;&#x5E76;&#x884C;&#x53D1;&#x9001;&#x591A;&#x4E2A;&#x8BF7;&#x6C42;&#x3002;</p><h3 id="&#x4F7F;&#x7528;Cookie&#x7684;&#x72B6;&#x6001;&#x7BA1;&#x7406;"><a href="#&#x4F7F;&#x7528;Cookie&#x7684;&#x72B6;&#x6001;&#x7BA1;&#x7406;" class="headerlink" title="&#x4F7F;&#x7528;Cookie&#x7684;&#x72B6;&#x6001;&#x7BA1;&#x7406;"></a>&#x4F7F;&#x7528;Cookie&#x7684;&#x72B6;&#x6001;&#x7BA1;&#x7406;</h3><p>HTTP&#x662F;&#x65E0;&#x72B6;&#x6001;&#x534F;&#x8BAE;&#xFF0C;&#x4E8E;&#x662F;&#x5F15;&#x5165;Cookie&#x6280;&#x672F;&#x3002;Cookie&#x6280;&#x672F;&#x901A;&#x8FC7;&#x5728;&#x8BF7;&#x6C42;&#x548C;&#x54CD;&#x5E94;&#x62A5;&#x6587;&#x4E2D;&#x5199;&#x5165;Cookie&#x4FE1;&#x606F;&#x6765;&#x63A7;&#x5236;&#x5BA2;&#x6237;&#x7AEF;&#x72B6;&#x6001;&#x3002;</p><h4 id="&#x6CA1;&#x6709;Cookie&#x4FE1;&#x606F;&#x72B6;&#x6001;&#x4E0B;&#x7684;&#x5BA2;&#x6237;&#x7AEF;&#x8BF7;&#x6C42;"><a href="#&#x6CA1;&#x6709;Cookie&#x4FE1;&#x606F;&#x72B6;&#x6001;&#x4E0B;&#x7684;&#x5BA2;&#x6237;&#x7AEF;&#x8BF7;&#x6C42;" class="headerlink" title="&#x6CA1;&#x6709;Cookie&#x4FE1;&#x606F;&#x72B6;&#x6001;&#x4E0B;&#x7684;&#x5BA2;&#x6237;&#x7AEF;&#x8BF7;&#x6C42;"></a>&#x6CA1;&#x6709;Cookie&#x4FE1;&#x606F;&#x72B6;&#x6001;&#x4E0B;&#x7684;&#x5BA2;&#x6237;&#x7AEF;&#x8BF7;&#x6C42;</h4><p><img src="/2016/06/21/HTTP&#x534F;&#x8BAE;&#x89E3;&#x6790;&#xFF08;&#x4E00;&#xFF09;/cookie1.png" alt="tcp/ip"></p><h4 id="&#x7B2C;&#x4E8C;&#x6B21;&#x4EE5;&#x540E;&#xFF08;&#x5B58;&#x6709;Cookie&#x4FE1;&#x606F;&#x72B6;&#x6001;&#xFF09;&#x7684;&#x8BF7;&#x6C42;"><a href="#&#x7B2C;&#x4E8C;&#x6B21;&#x4EE5;&#x540E;&#xFF08;&#x5B58;&#x6709;Cookie&#x4FE1;&#x606F;&#x72B6;&#x6001;&#xFF09;&#x7684;&#x8BF7;&#x6C42;" class="headerlink" title="&#x7B2C;&#x4E8C;&#x6B21;&#x4EE5;&#x540E;&#xFF08;&#x5B58;&#x6709;Cookie&#x4FE1;&#x606F;&#x72B6;&#x6001;&#xFF09;&#x7684;&#x8BF7;&#x6C42;"></a>&#x7B2C;&#x4E8C;&#x6B21;&#x4EE5;&#x540E;&#xFF08;&#x5B58;&#x6709;Cookie&#x4FE1;&#x606F;&#x72B6;&#x6001;&#xFF09;&#x7684;&#x8BF7;&#x6C42;</h4><p><img src="/2016/06/21/HTTP&#x534F;&#x8BAE;&#x89E3;&#x6790;&#xFF08;&#x4E00;&#xFF09;/cookie2.png" alt="tcp/ip"></p><h4 id="&#x5DE5;&#x4F5C;&#x8FC7;&#x7A0B;"><a href="#&#x5DE5;&#x4F5C;&#x8FC7;&#x7A0B;" class="headerlink" title="&#x5DE5;&#x4F5C;&#x8FC7;&#x7A0B;"></a>&#x5DE5;&#x4F5C;&#x8FC7;&#x7A0B;</h4><p>&#x7B2C;&#x4E00;&#x6B21;&#x5BA2;&#x6237;&#x7AEF;&#x5728;&#x6CA1;&#x6709;Cookie&#x4FE1;&#x606F;&#x72B6;&#x4F53;&#x4E0B;&#x8BF7;&#x6C42;&#x8FDE;&#x63A5;&#xFF0C;&#x8BF7;&#x6C42;&#x62A5;&#x6587;&#x7C7B;&#x4F3C;&#x5982;&#x4E0B;<br></p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">//&#x8BF7;&#x6C42;&#x65B9;&#x6CD5;&#xFF0C;URL</span><br><span class="line">Request URL:http://localhost:7101/signup</span><br><span class="line">Request Method:POST</span><br><span class="line"></span><br><span class="line">//&#x8BF7;&#x6C42;&#x9996;&#x90E8;&#x5B57;&#x6BB5;</span><br><span class="line">Connection:keep-alive</span><br><span class="line">Content-Type:application/x-www-form-urlencoded</span><br><span class="line">Content-Length:29</span><br><span class="line">Host:localhost:7101</span><br><span class="line">//&#x9996;&#x90E8;&#x5B57;&#x6BB5;&#x4E2D;&#x6CA1;&#x6709;Cookie</span><br><span class="line"></span><br><span class="line">//&#x5185;&#x5BB9;&#x5B9E;&#x4F53;&#xFF08;&#x8BF7;&#x6C42;&#x4E3B;&#x4F53;&#xFF09;</span><br><span class="line">name=admin3&amp;password=22222222</span><br></pre></td></tr></table></figure><p></p><p>&#x7B2C;&#x4E00;&#x6B21;&#x670D;&#x52A1;&#x5668;&#x7AEF;&#x63A5;&#x6536;&#x5230;HTTP&#x8BF7;&#x6C42;&#x62A5;&#x6587;&#x65F6;&#xFF0C;&#x4EA7;&#x751F;Set-Cookie&#x54CD;&#x5E94;&#x9996;&#x90E8;&#x5B57;&#x6BB5;&#xFF0C;&#x901A;&#x77E5;&#x5BA2;&#x6237;&#x7AEF;&#x4FDD;&#x5B58;Cookie<br></p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">//&#x54CD;&#x5E94;&#x72B6;&#x6001;&#x7801;</span><br><span class="line">Status Code:200 OK</span><br><span class="line"></span><br><span class="line">//&#x54CD;&#x5E94;&#x9996;&#x90E8;&#x5B57;&#x6BB5;</span><br><span class="line">Date:Mon, 20 Jun 2016 10:38:42 GMT</span><br><span class="line">Content-Length:9</span><br><span class="line">Content-Type:application/json; charset=utf-8</span><br><span class="line">//Set-Cookie&#x54CD;&#x5E94;&#x9996;&#x90E8;&#x5B57;&#x6BB5;</span><br><span class="line">Set-Cookie:BDSVRTM=132; path=/</span><br><span class="line">Set-Cookie:H_PS_PSSID=18286_1466_20317_18280_20368_20389_18134_17001_15371_11521; path=/; domain=.baidu.com</span><br><span class="line">Set-Cookie:__bsi=14590321692489225299_00_4_R_N_135_0303_C02F_N_I_I_0; expires=Mon, 20-Jun-16 13:49:06 GMT; domain=www.baidu.com; path=/</span><br><span class="line">Set-Cookie:BD_HOME=1; path=/</span><br><span class="line"></span><br><span class="line">//&#x54CD;&#x5E94;&#x4E3B;&#x4F53;</span><br><span class="line">{&quot;msg&quot;:2}</span><br></pre></td></tr></table></figure><p></p><p>&#x5BA2;&#x6237;&#x7AEF;&#x5F62;&#x6210;&#x4E00;&#x4E2A;Cookie&#x6587;&#x672C;&#x6587;&#x4EF6;&#x5B58;&#x50A8;&#x5728;&#x5BA2;&#x6237;&#x7AEF;&#x8BA1;&#x7B97;&#x673A;&#x7684;&#x786C;&#x4EF6;&#x6216;&#x5185;&#x5B58;&#x4E2D;<br>&#x5BA2;&#x6237;&#x7AEF;&#x518D;&#x6B21;&#x53D1;&#x9001;&#x8FDE;&#x63A5;&#x65F6;&#xFF0C;&#x5728;HTTP&#x8BF7;&#x6C42;&#x62A5;&#x6587;&#x7684;&#x9996;&#x90E8;&#x5B57;&#x6BB5;&#x4E2D;&#x6DFB;&#x52A0;Cookie&#x4FE1;&#x606F;&#x5E76;&#x81EA;&#x52A8;&#x53D1;&#x9001;<br></p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">//&#x8BF7;&#x6C42;&#x65B9;&#x6CD5;&#xFF0C;URL</span><br><span class="line">Request URL:http://localhost:7101/signup</span><br><span class="line">Request Method:POST</span><br><span class="line"></span><br><span class="line">//&#x8BF7;&#x6C42;&#x9996;&#x90E8;&#x5B57;&#x6BB5;</span><br><span class="line">Connection:keep-alive</span><br><span class="line">Content-Type:application/x-www-form-urlencoded</span><br><span class="line">Content-Length:29</span><br><span class="line">Host:localhost:7101</span><br><span class="line">//&#x9996;&#x90E8;&#x5B57;&#x6BB5;&#x6709;Cookie</span><br><span class="line">Cookie:BAIDUID=02F58F2A65AE213FB82C3C963C00E28D:FG=1; BIDUPSID=02F58F2A65AE213FB82C3C963C00E28D; PSTM=1464940250; BDUSS=YwLS10dlN6U3hnaWEwbnVPU3VqTXgxVDV3TVlJWXhZQVY0amFRc0NPMkZ-SGxYQVFBQUFBJCQAAAAAAAAAAAEAAACM4OyLX9fT3sgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIVvUleFb1JXU1; pgv_pvi=2793529344; BDRCVFR[feWj1Vr5u3D]=I67x6TjHwwYf0; H_PS_645EC=bf0dy07frZ1UKtJW014QafgXKI2iO55SiuDpRwJWBb4nwVC2cp%2Fs31gktrj%2BAKcUUoi2; BD_CK_SAM=1; BD_HOME=1; H_PS_PSSID=18286_1466_20317_18280_20368_20389_18134_17001_15371_11521; BD_UPN=123253</span><br><span class="line"></span><br><span class="line">//&#x5185;&#x5BB9;&#x5B9E;&#x4F53;&#xFF08;&#x8BF7;&#x6C42;&#x4E3B;&#x4F53;&#xFF09;</span><br><span class="line">name=admin3&amp;password=22222222</span><br></pre></td></tr></table></figure><p></p><blockquote><p>&#x63D0;&#x95EE;&#xFF1A; Cookie&#x548C;Session&#x5230;&#x5E95;&#x6709;&#x4EC0;&#x4E48;&#x533A;&#x522B;&#x5462;&#xFF1F;</p></blockquote></div><div></div><div></div><footer class="post-footer"><div class="post-tags"> <a href="/tags/tcp-ip/" rel="tag">#tcp/ip</a> <a href="/tags/http/" rel="tag">#http</a> <a href="/tags/web/" rel="tag">#web</a> <a href="/tags/ajax/" rel="tag">#ajax</a> <a href="/tags/javascript/" rel="tag">#javascript</a></div><div class="post-nav"><div class="post-nav-next post-nav-item"><a href="/2016/06/19/利用Gulp优化Hexo博客/" rel="next" title="利用Gulp优化Hexo博客"><i class="fa fa-chevron-left"></i> 利用Gulp优化Hexo博客</a></div><div class="post-nav-prev post-nav-item"></div></div></footer></article><div class="post-spread"><script>with(document)0[(getElementsByTagName("head")[0]||body).appendChild(createElement("script")).src="http://bdimg.share.baidu.com/static/api/js/share.js?cdnversion="+~(-new Date/36e5)]</script></div></div></div><div class="comments" id="comments"><div class="ds-thread" data-thread-key="2016/06/21/HTTP协议解析（一）/" data-title="HTTP协议解析（一）" data-url="http://yoursite.com/2016/06/21/HTTP协议解析（一）/"></div></div></div><div class="sidebar-toggle"><div class="sidebar-toggle-line-wrap"><span class="sidebar-toggle-line sidebar-toggle-line-first"></span><span class="sidebar-toggle-line sidebar-toggle-line-middle"></span><span class="sidebar-toggle-line sidebar-toggle-line-last"></span></div></div><aside id="sidebar" class="sidebar"><div class="sidebar-inner"><ul class="sidebar-nav motion-element"><li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap"> 文章目录</li><li class="sidebar-nav-overview" data-target="site-overview"> 站点概览</li></ul><section class="site-overview sidebar-panel"><div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person"> <img class="site-author-image" itemprop="image" src="/uploads/ziyi.jpg" alt="子奕"><p class="site-author-name" itemprop="name">子奕</p><p class="site-description motion-element" itemprop="description">postgraduate | front-end | nodejs</p></div><nav class="site-state motion-element"><div class="site-state-item site-state-posts"> <a href="/archives"><span class="site-state-item-count">4</span> <span class="site-state-item-name">日志</span></a></div><div class="site-state-item site-state-categories"> <a href="/categories"><span class="site-state-item-count">7</span> <span class="site-state-item-name">分类</span></a></div><div class="site-state-item site-state-tags"> <a href="/tags"><span class="site-state-item-count">24</span> <span class="site-state-item-name">标签</span></a></div></nav><div class="links-of-author motion-element"><span class="links-of-author-item"><a href="https://github.com/ziyi2" target="_blank" title="GitHub"><i class="fa fa-fw fa-github"></i> GitHub</a></span><span class="links-of-author-item"><a href="http://weibo.com/u/5590627594" target="_blank" title="微博"><i class="fa fa-fw fa-weibo"></i> 微博</a></span><span class="links-of-author-item"><a href="https://www.zhihu.com/people/zi-yi-91-26" target="_blank" title="知乎"><i class="fa fa-fw fa-book"></i> 知乎</a></span><span class="links-of-author-item"><a href="http://tieba.baidu.com/home/main?un=_%D7%D3%DE%C8&fr=index" target="_blank" title="贴吧"><i class="fa fa-fw fa-chrome"></i> 贴吧</a></span></div></section><section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active"><div class="post-toc"><div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#Web基础"><span class="nav-number">1.</span> <span class="nav-text">Web基础</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#使用HTTP协议访问Web"><span class="nav-number">1.1.</span> <span class="nav-text">使用HTTP协议访问Web</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#HTTP诞生"><span class="nav-number">1.2.</span> <span class="nav-text">HTTP诞生</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#Web历史"><span class="nav-number">1.2.1.</span> <span class="nav-text">Web历史</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#HTTP历史"><span class="nav-number">1.2.2.</span> <span class="nav-text">HTTP历史</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#网络基础TCP-IP"><span class="nav-number">1.3.</span> <span class="nav-text">网络基础TCP/IP</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#TCP-IP协议族"><span class="nav-number">1.3.1.</span> <span class="nav-text">TCP/IP协议族</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#TCP-IP分层管理"><span class="nav-number">1.3.2.</span> <span class="nav-text">TCP/IP分层管理</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#应用层"><span class="nav-number">1.3.2.1.</span> <span class="nav-text">应用层</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#传输层"><span class="nav-number">1.3.2.2.</span> <span class="nav-text">传输层</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#网络层（网络互连层）"><span class="nav-number">1.3.2.3.</span> <span class="nav-text">网络层（网络互连层）</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#链路层（网络接口层、数据链路层）"><span class="nav-number">1.3.2.4.</span> <span class="nav-text">链路层（网络接口层、数据链路层）</span></a></li></ol></li><li class="nav-item nav-level-4"><a class="nav-link" href="#TCP-IP通信传输流"><span class="nav-number">1.3.3.</span> <span class="nav-text">TCP/IP通信传输流</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#传输流"><span class="nav-number">1.3.3.1.</span> <span class="nav-text">传输流</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#发送端封装"><span class="nav-number">1.3.3.2.</span> <span class="nav-text">发送端封装</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#接收端解封"><span class="nav-number">1.3.3.3.</span> <span class="nav-text">接收端解封</span></a></li></ol></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#DNS、TCP、IP"><span class="nav-number">1.4.</span> <span class="nav-text">DNS、TCP、IP</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#负责域名解析的DNS服务"><span class="nav-number">1.4.1.</span> <span class="nav-text">负责域名解析的DNS服务</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#确保可靠的TCP协议"><span class="nav-number">1.4.2.</span> <span class="nav-text">确保可靠的TCP协议</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#负责传输的IP协议"><span class="nav-number">1.4.3.</span> <span class="nav-text">负责传输的IP协议</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#各种协议与HTTP协议的关系"><span class="nav-number">1.4.4.</span> <span class="nav-text">各种协议与HTTP协议的关系</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#URI和URL"><span class="nav-number">1.5.</span> <span class="nav-text">URI和URL</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#简单的HTTP协议"><span class="nav-number">2.</span> <span class="nav-text">简单的HTTP协议</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#HTTP通信"><span class="nav-number">2.1.</span> <span class="nav-text">HTTP通信</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#HTTP请求和响应"><span class="nav-number">2.2.</span> <span class="nav-text">HTTP请求和响应</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#请求报文"><span class="nav-number">2.2.1.</span> <span class="nav-text">请求报文</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#响应报文"><span class="nav-number">2.2.2.</span> <span class="nav-text">响应报文</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#Ajax示例"><span class="nav-number">2.2.3.</span> <span class="nav-text">Ajax示例</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#HTTP是不保存状态"><span class="nav-number">2.3.</span> <span class="nav-text">HTTP是不保存状态</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#请求URI定位资源"><span class="nav-number">2.4.</span> <span class="nav-text">请求URI定位资源</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#HTTP请求方法"><span class="nav-number">2.5.</span> <span class="nav-text">HTTP请求方法</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#持久连接节省通信量"><span class="nav-number">2.6.</span> <span class="nav-text">持久连接节省通信量</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#持久连接"><span class="nav-number">2.6.1.</span> <span class="nav-text">持久连接</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#管线化"><span class="nav-number">2.6.2.</span> <span class="nav-text">管线化</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#使用Cookie的状态管理"><span class="nav-number">2.7.</span> <span class="nav-text">使用Cookie的状态管理</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#没有Cookie信息状态下的客户端请求"><span class="nav-number">2.7.1.</span> <span class="nav-text">没有Cookie信息状态下的客户端请求</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#第二次以后（存有Cookie信息状态）的请求"><span class="nav-number">2.7.2.</span> <span class="nav-text">第二次以后（存有Cookie信息状态）的请求</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#工作过程"><span class="nav-number">2.7.3.</span> <span class="nav-text">工作过程</span></a></li></ol></li></ol></li></ol></div></div></section></div></aside></div></main><footer id="footer" class="footer"><div class="footer-inner"><div class="copyright"> &copy; 2016.06.16<span itemprop="copyrightYear"></span> <span class="with-love">|</span> <span class="author" itemprop="copyrightHolder">子奕</span></div></div></footer><div class="back-to-top"><i class="fa fa-arrow-up"></i></div></div><script type="text/javascript">"[object Function]"!==Object.prototype.toString.call(window.Promise)&&(window.Promise=null)</script><script type="text/javascript" src="/vendors/jquery/index.js?v=2.1.3"></script><script type="text/javascript" src="/vendors/fastclick/lib/fastclick.min.js?v=1.0.6"></script><script type="text/javascript" src="/vendors/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script><script type="text/javascript" src="/vendors/velocity/velocity.min.js?v=1.2.1"></script><script type="text/javascript" src="/vendors/velocity/velocity.ui.min.js?v=1.2.1"></script><script type="text/javascript" src="/vendors/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script><script type="text/javascript" src="/js/src/utils.js?v=5.0.1"></script><script type="text/javascript" src="/js/src/motion.js?v=5.0.1"></script><script type="text/javascript" src="/js/src/affix.js?v=5.0.1"></script><script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.0.1"></script><script type="text/javascript" src="/js/src/scrollspy.js?v=5.0.1"></script><script type="text/javascript" src="/js/src/post-details.js?v=5.0.1"></script><script type="text/javascript" src="/js/src/bootstrap.js?v=5.0.1"></script><script type="text/javascript">var duoshuoQuery={short_name:"ziyi2"};!function(){var t=document.createElement("script");t.type="text/javascript",t.async=!0,t.id="duoshuo-script",t.src=("https:"==document.location.protocol?"https:":"http:")+"//static.duoshuo.com/embed.js",t.charset="UTF-8",(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(t)}()</script><script type="text/javascript">function proceedsearch(){$("body").append('<div class="popoverlay">').css("overflow","hidden"),$(".popup").toggle()}var isfetched=!1,search_path="search.xml";0==search_path.length&&(search_path="search.xml");var path="/"+search_path,searchFunc=function(e,t,a){"use strict";$.ajax({url:e,dataType:"xml",async:!0,success:function(e){isfetched=!0,$(".popup").detach().appendTo(".header-inner");var r=$("entry",e).map(function(){return{title:$("title",this).text(),content:$("content",this).text(),url:$("url",this).text()}}).get(),c=document.getElementById(t),s=document.getElementById(a);c.addEventListener("input",function(){var e=0,t='<ul class="search-result-list">',a=this.value.trim().toLowerCase().split(/[\s\-]+/);s.innerHTML="",this.value.trim().length>1&&r.forEach(function(r){var c=!0,s=r.title.trim().toLowerCase(),n=r.content.trim().replace(/<[^>]+>/g,"").toLowerCase(),o=r.url,i=-1,l=-1,p=-1;if(""!=s&&""!=n&&a.forEach(function(e,t){i=s.indexOf(e),l=n.indexOf(e),0>i&&0>l?c=!1:(0>l&&(l=0),0==t&&(p=l))}),c){e+=1,t+="<li><a href='"+o+"' class='search-result-title'>"+s+"</a>";var h=r.content.trim().replace(/<[^>]+>/g,"");if(p>=0){var u=p-20,d=p+80;0>u&&(u=0),0==u&&(d=50),d>h.length&&(d=h.length);var f=h.substring(u,d);a.forEach(function(e){var t=new RegExp(e,"gi");f=f.replace(t,'<b class="search-keyword">'+e+"</b>")}),t+='<p class="search-result">'+f+"...</p>"}t+="</li>"}}),t+="</ul>",0==e&&(t='<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>'),""==a&&(t='<div id="no-result"><i class="fa fa-search fa-5x" /></div>'),s.innerHTML=t}),proceedsearch()}})};$(".popup-trigger").mousedown(function(e){e.stopPropagation(),0==isfetched?searchFunc(path,"local-search-input","local-search-result"):proceedsearch()}),$(".popup-btn-close").click(function(e){$(".popup").hide(),$(".popoverlay").remove(),$("body").css("overflow","")}),$(".popup").click(function(e){e.stopPropagation()})</script></body></html>